import {
  normalize,
  schema
} from 'normalizr';
import MoviesTag from './components/movies-tag/';

export default {
  data() {
    return {
      /**
       * 城市列表
       */
      citys: [{
          name: '北京'
        },
        {
          name: '上海'

        },
        {
          name: '广州'
        },
        {
          name: '深圳'
        },
        {
          name: '杭州'
        }
      ]
    }
  },
  computed: {
    movingList() {
      return this.$store.getters.movingList
    },
  },
  components: {
    MoviesTag,
  },
  // 添加以下代码
  metaInfo() {
    const title = 'M.M.F 小屋 - 首页'
    return {
      title,
      meta: [{
        vmid: 'description',
        name: 'description',
        content: title
      }]
    }
  },
  beforeMount() {
    // document.title = '正在热映';
    this.$store.dispatch('getMoving');
  },
  mounted() {
    // Define a users schema
    const user = new schema.Entity('users');

    // Define your comments schema
    const comment = new schema.Entity('comments', {
      commenter: user
    });

    // Define your article
    const article = new schema.Entity('articles', {
      author: user,
      comments: [comment]
    });

    const originalData = {
      "id": "123",
      "author": {
        "id": "1",
        "name": "Paul"
      },
      "title": "My awesome blog post",
      "comments": [{
        "id": "324",
        "commenter": {
          "id": "2",
          "name": "Nicole"
        }
      }]
    };

    const normalizedData = normalize(originalData, article);
    console.log(normalizedData);
  },
};